package cn.edu.sptc.sms_weiwubo.service.impl;

import cn.edu.sptc.sms_weiwubo.dao.StudentMapper;
import cn.edu.sptc.sms_weiwubo.entity.Student;
import cn.edu.sptc.sms_weiwubo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public boolean insertStudent(Student student) {
        if(studentMapper.insert(student) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateStudent(Student student) {
        if(studentMapper.update(student) > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteStudent(Long id) {
        if(studentMapper.delete(id)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Student> queryByAll() {
        return studentMapper.selelectAll();
    }

    @Override
    public Student queryByID(Long id) {
        return studentMapper.selectByID(id);
    }
}
